Skip to main content

SORT MERGE JOIN

Short Description

The join consists of a sort join, in which both inputs are sorted on the join key, followed by a merge join, in which the sorted lists are merged.

Detailed Description​

In a SORT-MERGE join, the first row source is sorted by its join columns, then the second row source is sorted - also by its join columns. The now sorted row sources and then merged together, feeding matching rows to the next execution step.

It should be noted that SORT-MERGE joins are specific to equijoins - i.e. where your where clause contains an equality = (A.PRODUCT_CODE = B.PRODUCT_CODE). These joins can be useful when a NESTED LOOPS join is too inefficient, or both row sources are large.

Further Reading​

Search online​

If this article doesn't have the information you need you can try searching online. Remember, you can contribute suggestions to this page.